package com.konne.nightmare.FastPublicOpinion.ui.information.activity;

import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.Nullable;

import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.BarUtils;
import com.blankj.utilcode.util.FragmentUtils;
import com.konne.nightmare.FastPublicOpinion.R;
import com.konne.nightmare.FastPublicOpinion.base.BaseMvpActivity;
import com.konne.nightmare.FastPublicOpinion.base.BaseMvpFragment;
import com.konne.nightmare.FastPublicOpinion.mvp.presenter.ImportDatabasePresenter;
import com.konne.nightmare.FastPublicOpinion.mvp.view.IImportDatabaseView;
import com.konne.nightmare.FastPublicOpinion.utils.LoadProgressDialog;
import com.konne.nightmare.FastPublicOpinion.widget.QJActionBar;

import butterknife.BindView;

/**
 * Create by ws.
 * on Data:2022/2/11  Time:下午 2:16.
 * description: 导入资料的选择资料页面 .
 */
public class ImportDatabaseAct extends BaseMvpActivity<IImportDatabaseView, ImportDatabasePresenter>implements IImportDatabaseView {
    @BindView(R.id.action_bar)
    QJActionBar actionBar;
    private int type;
    /**
     * 页面启动
     * @param type 0,选择章节，1导入已有，2资料库
     * */
    public static void start(int type){
        Intent intent=new Intent(ActivityUtils.getTopActivity(),ImportDatabaseAct.class);
        intent.putExtra("type",type);
        ActivityUtils.startActivity(intent);
    }
    @Override
    protected ImportDatabasePresenter createPresenter() {
        return new ImportDatabasePresenter();
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public int getLayout() {
        return R.layout.activity_create_group;
    }

    @Override
    public void initView() {
        type=getIntent().getIntExtra("type",0);
        BarUtils.transparentStatusBar(this);
        BarUtils.setStatusBarLightMode(this,true);
        String title="";
        switch (type){
            case 0:
                title="选择章节";
                break;
            case 1:
                title="导入已有";
                break;
            case 2:
                title="从资料库中导入";
                break;
        }
        actionBar.setTitle(title);
    }

    @Override
    public void initData(Bundle savedInstanceState) {
        mPresenter.init(type);
    }

    @Override
    public void setFragment(BaseMvpFragment fragment) {
        FragmentUtils.add(getSupportFragmentManager(),fragment,R.id.fl_content);
        FragmentUtils.show(fragment);
    }

    @Override
    public LoadProgressDialog getLoadDialog() {
        return null;
    }

    @Override
    public void cancelLoadDialog() {

    }
}
